package com.huangjue.backend.service.impl;

import com.huangjue.backend.entity.Homework;
import com.huangjue.backend.mapper.HomeworkMapper;
import com.huangjue.backend.service.HomeworkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 作业服务实现类
 */
@Service
public class HomeworkServiceImpl implements HomeworkService {
    @Autowired
    private HomeworkMapper homeworkMapper;

    /** 根据ID查询作业 */
    @Override
    public Homework getHomeworkById(Integer homeworkId) {
        return homeworkMapper.selectById(homeworkId);
    }

    /** 查询所有作业 */
    @Override
    public List<Homework> getAllHomeworks() {
        return homeworkMapper.selectAll();
    }

    @Override
    public List<Homework> getHomeworksByVideoId(Integer videoId) {
        return homeworkMapper.selectByVideoId(videoId);
    }

    @Override
    public List<Homework> getHomeworksByDemoId(Integer demoId) {
        return homeworkMapper.selectByDemoId(demoId);
    }
} 